package com.scanner;

import android.util.Log;

public class ImageProcessor extends Thread 
{
	boolean running = true;
    JniWrapper jniWrapper;
    
    public ImageProcessor(){
        super();
        System.loadLibrary("JniWrapper");
        jniWrapper = new JniWrapper();
    }
    
	 @Override
	    public synchronized void run()
	    {
	    	Log.d("myLog", "ImageProcessor run");

	        while (running)
	        {  
	            try{
	            	Log.d("myDebug","ImageProcessor going to sleep");
	            	Thread.sleep(MainScannerActivity.wait4nextAF);            
	            	Log.d("myDebug","ImageProcessor wake up");  
	            }
	            catch (InterruptedException e)
	            {
	            	return;
	            }
	        }
	        return;
	    }	
	 
	 public void StopRunning()
	    {
	    	running = false;
	    }
	    
	 public void StartRunning()
	    {
	    	running = true;
	    }
	 
	 public int[] CalculatePoints(byte[] imageData, int height, int width, int optionEQ, int optionMask)
	 {
		 if (jniWrapper != null)
		 {
			 return jniWrapper.calculatePoints(imageData, height, width, optionEQ, optionMask);
		 }
		 return null;
	 }
}
